#!/bin/bash
############################################
# Cloning temporary repo
############################################
#REPO=sap
#ORIGINREPO=$ORIGIN/$REPO/
#CLONE=/tmp/$REPO.$RANDOM
#cd /tmp
#/bin/sudo -u git /usr/bin/git clone $ORIGINREPO $CLONE
#cd $CLONE
############################################
#	TAGSCOMMITTED=$(git describe --abbrev=0 --tags)
#	PRO=$(git describe --abbrev=0 --tags | sed 's/\(.*\)\.[0-9]*/\1/')
#	EPI=$(echo `git describe --abbrev=0 --tags | awk -F'.' '{print $NF}'` + 1 | bc)
#	TAG=$PRO.$EPI
#	if git push; then git tag $TAG; git push --tags; else TAG=$TAGSCOMMITTED; fi
#	DEPOT=/central/code/depot
#	ORIGIN=git://sapnfs/$REPO/
#	CODE=${REPO}.git_${TAG}.tar.gz
#	LATEST=${REPO}.latest.tar.gz
#	LATESTVERSION=${REPO}.latest_version.txt
#	cd /tmp
#	cat <<-EOF | sudo -u git bash
#		umask 022
#		/usr/bin/git archive --format=tar.gz -o $DEPOT/$CODE --remote=$ORIGIN $TAG
#		cd $DEPOT && /usr/bin/ln -sf $CODE $LATEST
#		cksum $CODE > ${CODE}.cksum && echo ${TAG} > $LATESTVERSION
#		echo "Cleaning up $DEPOT"
#		ls -1td $DEPOT/${REPO}* | /usr/bin/tail -n +6 | xargs rm -rf 
#	EOF
#rm -rf $CLONE 2>&1 > /dev/null
git tag `git describe | awk -F'-g[0-9a-fA-F]+' '{print $1}'`
